export function $h(type: string, config: object, ...children: any[]): HTMLElement {
    const dom = document.createElement(type);
    Object.assign(dom, config || {});
    const elements = [];
    ($flatten(children, elements), elements).forEach(el => dom.append(el));
    return dom;
}
export function $flatten(data: any[], result: any[]): void {
    data?.forEach(el => {
        if (Array.isArray(el)) {
            $flatten(el, result);
        } else {
            result.push(el);
        }
    })
}